package org.bees.cms.web.util.velocity.element;

import net.sf.json.JSONObject;

public class AbstractDereferenceElement extends AbstractElement {
	private static final long serialVersionUID = -4695187891107717655L;

	protected String action = "";
	protected String name = "";
	protected String property = "";
	protected String context = "";

	@Override
	public void from(JSONObject t) throws Exception {
		super.from(t);
		name = t == null ? name : t.containsKey("name") ? t.getString("name") : name;
		property = t == null ? property : t.containsKey("property") ? t.getString("property") : property;
		action = t == null ? action : t.containsKey("action") ? t.getString("action") : action;
		context = t == null ? context : t.containsKey("context") ? t.getString("context") : context;
	}

	@Override
	public JSONObject to() throws Exception {
		return super.to();
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

}
